package com.google.code.roztocze358.server.gamerules;

import java.util.ArrayList;
import java.util.List;

import com.google.code.roztocze358.server.businessobjects.Card;
import com.google.code.roztocze358.server.businessobjects.CardsDeck;

public class SimpleCardsDealer implements CardsDealer {
	
	private CardsDeck deck;
	
	public SimpleCardsDealer(CardsDeck deck) {
		this.deck = deck;
	}

	@Override
	public List<Card> dealCardsForBlack() {
		return getCards(0,15);
	}

	@Override
	public List<Card> dealCardsForGray() {
		return getCards(16,31);
	}

	@Override
	public List<Card> dealCardsForWhite() {
		return getCards(32,47);
	}
	
	@Override
	public List<Card> dealCardsForKitty() {
		return getCards(48,51);
	}
	
	public List<Card> getCards(int first, int last) {
		List<Card> result = new ArrayList<Card>();
		for(int i = first; i<last-1; i++) {
			result.add(deck.getCard(i));
		}
		return result;
	}

}
